<?php


namespace app\live\model;


use app\BaseModel;
use think\facade\Cache;

class ChargeRulesModel extends BaseModel
{
    public $pk = 'id';
    protected $table = 'live_charge_rules';
    public $swftype = ['0' => 'PNG', '1' => 'GIF'];

    public function getAllRules(){

        $key = 'all_charge_rules_list';
        $list = Cache::get($key);

        if(!$list){
            $list = $this->field('id,name,money,give')
                ->order('list_order DESC')
                ->select();
            if($list){
                Cache::set($key, $list);
            }
        }

        /*foreach($list as $k=>$v){
            $list[$k]['gift_img'] = get_upload_path($v['gifticon']);
        }*/

        return $list;

    }

}